#pragma once

#include "IGUICinematicCtrl.h"
#include <IGUIScrollbar.h>
#include <IrrArray.h>
#include <SColor.h>
#include <IVideoDriver.h>

class CCinematicCommand;
class CCinematicThread;

namespace irr
{
namespace gui
{
	class IFPSGUITable;

	//! Default list box GUI element.
	class CGUICinematicCtrl : public IGUICinematicCtrl
	{
		friend IGUICinematicCtrl *AddGUICinematicCtrl( IGUIEnvironment *env, const core::rect<s32> Rectangle,IGUIElement *parent,s32 id);

		public:

			//! destructor
			~CGUICinematicCtrl();

			virtual void draw();
			
			bool OnEvent(const SEvent& event);

		protected:
			
		public:
			IGUIFont *Font;
			IGUIFont *OverrideFont;
			//IGUIScrollBar* ScrollBarV;
			//IGUIScrollBar* ScrollBarH;
			video::IVideoDriver *video;		
			
			//IGUIStaticText* HeaderName;
			//IGUIStaticText* HeaderTime;
			IFPSGUITable* table ;
			virtual bool SetOverrideFont(IGUIFont *font);
			virtual IGUIFont *GetOverrideFont();
			virtual int AddThread(CCinematicThread* t);
			virtual void RemoveThread(s32 index);

			virtual void* GetSelectedData();
			virtual const wchar_t* GetSelectedText();
			virtual void SetSelectedText(const wchar_t* text);
			virtual void SetSelectedData( void*);
			virtual void SetSelectedColor(irr::video::SColor color , irr::core::stringw text , s32 columns = 1 );

			virtual s32 GetSelectedRow();
			virtual s32 GetSelectedColumn();
			virtual void SetSelectedColumn(s32 column);
			virtual s32 GetTableRows();
			virtual s32 GetTableColumns();
			virtual void* GetTableData(s32 , s32);
			virtual const wchar_t* GetTableText(s32 , s32);
			virtual void SetTableData(s32 , s32 , void*);
			virtual void SetTableColor(s32 r , s32 c , irr::video::SColor color , irr::core::stringw text , s32 columns = 1);
		protected:
			//! constructor
			CGUICinematicCtrl(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
		
		private:			
			irr::core::array<CCinematicThread*>	m_threads;
			irr::core::array<CCinematicCommand*>*	m_CopyCinematic;

			s32 ClickedRow;
			s32 ClickedColumn;

			s32 rightClickedRow;
			s32 rightClickedColumn;
	};


} // end namespace gui
} // end namespace irr